package com.boost.tjvm;

public class StaticDispathch {
    static abstract class Human{}

    static class Man extends Human{}

    static class  Woman extends Human{}

    public void sayHello(Human guy){
        System.out.println("hello gay");
    }

    public void sayHello(Man man){
        System.out.println("hello Man");
    }

    public void sayHello(Woman woman){
        System.out.println("hello Woman");
    }


    public static void sayHello(){
        System.out.println("static");
    }


    public static void main(String [] arag){
        /**
         * 非运行期间
         */
        //类加载时候(确定唯一版本) 解析
        StaticDispathch.sayHello();
        Human man = new Man();
        Human woman = new Woman();
        //编译阶段 的静态分派
        StaticDispathch d=new StaticDispathch();
        d.sayHello(man);
        d.sayHello(woman);
        d.sayHello((Man)man);
        d.sayHello((Woman)woman);
        //总结：解析是决定调用哪个类的， 静态分派是决定调哪个方法的






    }

}
